package com.manlost.biz.tag.impl.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.manlost.biz.common.ibatis.BaseSqlMapClientDaoSupport;
import com.manlost.biz.tag.impl.dao.interfaces.BabyTagAccountRelationDAO;
import com.manlost.biz.tag.model.dataobject.BabyTagAccoutRelation;
import com.manlost.biz.tag.query.CountBabyTagAccountRelationQuery;
import com.manlost.biz.tag.query.ListBabyIdsQuery;
import com.manlost.biz.tag.query.ListBabyTagAccountRelationQuery;
import com.manlost.biz.tag.query.ListTagIdsQuery;

/**
 * 类BabyTagAccountRelationDAOImpl.java的实现描述：TODO 类实现描述
 * 
 * @author xiaochuan.luxc 2012-3-29 下午11:37:50
 */
@Repository
@SuppressWarnings("unchecked")
public class BabyTagAccountRelationDAOImpl extends BaseSqlMapClientDaoSupport implements BabyTagAccountRelationDAO {

    public BabyTagAccoutRelation insert(BabyTagAccoutRelation record) {
        getSqlMapClientTemplate().insert("baby_tag_account_relation.insert", record);
        return record;
    }

    public int delete(BabyTagAccoutRelation record) {
        return getSqlMapClientTemplate().delete("baby_tag_account_relation.delete", record);
    }

    public List<Long> listBabyIdsByComplexQuery(ListBabyTagAccountRelationQuery query) {
        return getSqlMapClientTemplate().queryForPage("baby_tag_account_relation.countBabyIdsByComplexQuery",
                                                      "baby_tag_account_relation.listBabyIdsByComplexQuery", query);
    }

    public List<Long> listBabyIdsByQuery(ListBabyIdsQuery query) {
        return getSqlMapClientTemplate().queryForPage("baby_tag_account_relation.countBabyIdsByQuery",
                                                      "baby_tag_account_relation.listBabyIdsByQuery", query);
    }

    public Integer countBabyByQuery(CountBabyTagAccountRelationQuery query) {
        return (Integer) getSqlMapClientTemplate().queryForObject("baby_tag_account_relation.countBabyByQuery", query);
    }

    public List<Long> listTagIdsByQuery(ListTagIdsQuery query) {
        return (List<Long>) getSqlMapClientTemplate().queryForList("baby_tag_account_relation.listTagIdsByQuery", query);
    }

}
